package com.example.demo.controller;


import com.example.demo.pojo.OrderDetailDTO;
import com.example.demo.service.OrderDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/orderDetails")
public class OrderDetailsController {

    @Autowired
    private OrderDetailsService orderDetailsService;

    @PostMapping("/add")
    public ResponseEntity<String> addOrderDetail(@RequestBody OrderDetailDTO orderDetail) {
        boolean success = orderDetailsService.addOrderDetail(orderDetail);
        return success ? ResponseEntity.ok("添加成功") : ResponseEntity.badRequest().body("添加失败");
    }
}
